<div class="tab-pane fade in active" id="change_pw">
<%if current_user%>
	<%=form_for(current_user,:url=>users_user_setting_edit_pwd_path(:js), :remote=> true, :html => { :class=>"form-horizontal",:role=>"form" }) do |f|%>
		<input type="password" name="user[old_password]" class="form-control" id="old_pwd" placeholder ="原密码" autocomplete="off"/>
		<%= f.password_field :password,:id => "new_pw", :class => "form-control",:placeholder=>"新密码", autocomplete: "off" %>
		<%= f.password_field :password_confirmation,:id => "confirm_pw",:class => "form-control", :placeholder=>"确认密码",autocomplete: "off" %>
		<input type="submit" class="btn btn-primary" value="确认修改" />
	<% end %>
<% end %>
</div>
<div>
	<%=link_to "返回",identifier(current_user)%>
</div>
<script>
	$("#change_pw form input[type='submit']").click(function() {
		var new_pw = $("#new_pw").val();
		var confirm_pw = $("#confirm_pw").val();
		var old_pw = $("#old_pwd").val();
		
		if (isTextNull(new_pw)|| isTextNull(confirm_pw) || isTextNull(old_pw)) {
			message_alert("Error：密码不能为空！","err");
			return false;
		} else if (new_pw != confirm_pw) {
			message_alert("Error：两次密码输入不一致，请重新输入！","err");
			return false;
		} 
		$("form").waitMe({
			effect:'win8',
			text:'加载中...',
			bg:'rgba(0,0,0,0.2)',
			color:'#0095DE'
		});
		return true;
	});
</script>